Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add UnitUtil class #66

Merged
merged 3 commits into from
Mar 19, 2021
Merged

add UnitUtil class #66

merged 3 commits into from
Mar 19, 2021

Conversation

javeme
Copy link
Contributor

@javeme javeme commented Mar 7, 2021

Change-Id: Ic1a434fda3a051c10e37190aaab22e9db466bb23

javeme added 2 commits March 7, 2021 23:26
Change-Id: Ic1a434fda3a051c10e37190aaab22e9db466bb23
Change-Id: Ice09c3c01be6e12f74b889d28b9eae93c5fa6a78
@codecov
Copy link

codecov bot commented Mar 7, 2021

Codecov Report

Merging #66 (52fbe8c) into master (42e5260) will increase coverage by 0.45%.
The diff coverage is 94.38%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #66      +/-   ##
============================================
+ Coverage     84.78%   85.24%   +0.45%     
- Complexity      767      795      +28     
============================================
  Files            60       61       +1     
  Lines          2209     2298      +89     
  Branches        325      341      +16     
============================================
+ Hits           1873     1959      +86     
+ Misses          191      190       -1     
- Partials        145      149       +4     
Impacted Files Coverage Δ Complexity Δ
src/main/java/com/baidu/hugegraph/util/Bytes.java 89.28% <ø> (ø) 17.00 <0.00> (ø)
...ava/com/baidu/hugegraph/version/CommonVersion.java 50.00% <ø> (ø) 1.00 <0.00> (ø)
...c/main/java/com/baidu/hugegraph/util/UnitUtil.java 94.38% <94.38%> (ø) 27.00 <27.00> (?)
...n/java/com/baidu/hugegraph/concurrent/RowLock.java 97.61% <0.00%> (+4.76%) 17.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 42e5260...52fbe8c. Read the comment docs.

Linary
Linary previously approved these changes Mar 17, 2021
(long) (755 * 1.024) * Bytes.PB);
Assert.assertEquals("7.75 EB", value);

// overflow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overflow

e.getMessage());
});

// invalid unit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Change-Id: I67c7b38979b2c0603878d48929247ec0282d10d9
@Linary Linary merged commit 98844d8 into master Mar 19, 2021
@Linary Linary deleted the add-UnitUtil branch March 19, 2021 12:44
Assert.assertEquals(0L, UnitUtil.bytesFromReadableString("0 KB"));
Assert.assertEquals(Bytes.KB * 1L,
UnitUtil.bytesFromReadableString("1 KB"));
Assert.assertEquals((long) (Bytes.KB * 3.14),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I detect that this code is problematic. According to the Bad practice (BAD_PRACTICE), CNT: Rough value of known constant found (CNT_ROUGH_CONSTANT_VALUE).
It's recommended to use the predefined library constant for code clarity and better precision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants